/**
    ******************************************************************************
    * @file    main.cpp
    * @author  debian
    * @version V1.0.0
    * @date    2020-01-20
    * @brief   责任链模式
    ******************************************************************************
    * @attention
    *
    *
    ******************************************************************************
    */ 

/* Includes ------------------------------------------------------------------*/
//#include "main.h"
using namespace std;
#include <iostream>
#include <string>
#include "resquest.h"
#include "handler.h"
#include "employee.h"
#include "bankManager.h"
#include "cityBankManager.h"

/** @addtogroup DataStruct_Driver
    * @{
    */

/** @addtogroup main
    * @{
    */

/* Private typedef -----------------------------------------------------------*/

/* Private define ------------------------------------------------------------*/

/* Private macro -------------------------------------------------------------*/

/* Private variables ---------------------------------------------------------*/

/* Private function prototypes -----------------------------------------------*/

/* Private functions ---------------------------------------------------------*/


/** @defgroup main_Exported_Functions main Exported Functions
    * @{
    */

/** @defgroup main_Exported_Functions_Group1 Initialization and deinitialization functions
    *  @brief    Initialization and Configuration functions
    *
@verbatim    
    ===============================================================================
                ##### Initialization and deinitialization functions #####
    ===============================================================================
    [..]
        This section provides functions allowing to initialize and de-initialize the main
        to be ready for use.
 
@endverbatim
    * @{
    */ 

/**
    * @brief  main函数
    * @param  
    * @retval 
    */ 
    int main(void)
    {
        printf("hello c++\n");
        
        //先申请个消息的类，利用构造函数，填写各个变量的值
        Resqest *resq = new Resqest("Tibin", 22, 10);

        //市行长，创建一个对象，参数nullptr，市行长我目前实现的是最后一个，没有后继
        CityBankManager *cManager = new CityBankManager(nullptr);
        //行长，行长的后继就是市行长，这是直接调用构造函数的方法，设置后继指针的
        BankManager *bManager = new BankManager(cManager);
        Employee *employ = new Employee(bManager);
        Handler *handler = new Handler(employ);
        
        // handler->show();
        // employ->show();
        // bManager->show();
        // cManager->show();
        //从最低级的开始调用handle处理函数，handle函数内部有判断是不是找后继的情况
        handler->handle(resq);

        return 0;
    }

    
/**
    * @}
    */

/** @defgroup main_Exported_Functions_Group2 operation functions 
    *  @brief   operation functions
    *
@verbatim   
    ===============================================================================
                        ##### operation functions #####
    ===============================================================================
    [..]
        This subsection provides a set of functions allowing to manage the main.

@endverbatim
    * @{
    */

        /* 操作函数写在这里 */

    /**
    * @}
    */


/**
    * @}
    */

/**
    * @}
    */

/**
    * @}
    */

/************************ (C) 2020 HOME 深圳龙华 *****END OF FILE****/

